WDV221 Intro Javascript

Project-4 Comparisons and If Statements - In Class Exercises


Please complete the following exercises on this page. When complete post the page to your WDV221 folder on the server. Make a link in your WDV221 Intro Javascript page for this assignment. Contact your instructor and demonstrate that you have completed the assignment.

Using Blackboard complete the In Class Exercise Assignment. Download your Homework project and being working on it with your remaining time.

For each exercise use a comment line to put the Exercise number within the script. Also place a short description of what the script is doing.


Use this form to gather input and display results.

Value 1:

Value 2:

Result:

Use the form above for the following exercises:

1. Enter a number in Value 1 and Value 2. Display the larger number in the Result field of the form above.

2. Enter a number in Value 1 and Value 2. Display the smaller number in the Result field of the form above.

3. Enter a number in Value 1 and Value 2. Display "Equal"in the Result field of the form above if both values are the same otherwise display "Not Equal".

For the next two exercises enter a name in Value 1 and Value 2.

5. Display "Same" in the Results field if both names are the same including capital letters, otherwise put "Different" in the Fesults field.

6. Display "Same" in the Results field if both names are the same regardless of capital letter., otherwise put "Different" in the Results field.

 

PART II

Color:

Result:

Use the form above for the following exercises:

1. Create a function called matchColor( ). The function will take the color entered in the Color field and see if it is standard color. The standard colors are Red, Green and Blue.

2. The function will display "Match" if the color entered is one of the standard colors or "Not Found" if it isn't. Capital letters do not matter so make your comparison case insensitive.

3. Display your message in the Result paragraph. Use the .innerHTML property to display your message.